package com.example.demo.redis.controller;

import com.example.demo.model.Material;
import com.example.demo.redis.service.RedisTestService;
import com.example.demo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by 86151 on 2018/12/27.
 */
@RestController
public class RedisTestController {
    @Autowired
    private RedisTestService redisTestService;
    @GetMapping("testRedis")
    public Result<Material> queryMaterialById(@RequestParam("id") Integer id){
        return redisTestService.queryMaterialById(id);
    }
    @PostMapping("updateRedis")
    public Result<List<Material>> updateRedis(@RequestBody Material material){
        return redisTestService.updateRedis(material);
    }
    @GetMapping("deleteRedis")
    public Result<List<Material>> deleteRedis(@RequestParam("id") Integer id){
        return redisTestService.deleteRedis(id);
    }
}
